package com.employees.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.employees.bean.Employee;
import com.employees.bean.Employeeinfo;
import com.employees.bean.Employeeskill;
import com.employees.service.EmployeeService;

public class EmployeeDelete extends Action {

	private EmployeeService employeeService;

	public void setEmployeeService(EmployeeService employeeService) {
		this.employeeService = employeeService;
	}

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String SkillId=request.getParameter("SkillId");
		String InfoId=request.getParameter("InfoId");
		String employeeNo=request.getParameter("employeeNo");
		String employeeName=request.getParameter("employeeName");
		
		Employee e=new Employee();
		e.setNo(employeeNo);
		e.setName(employeeName);
		
		Employeeinfo info=new Employeeinfo();
		
		info.setId(Integer.parseInt(InfoId));
		
		//info.setEmployee(e);
		
		Employeeskill skill=new Employeeskill();
		skill.setId(Integer.parseInt(SkillId));
		//skill.setEmployee(e);

		
		employeeService.deleteEmployee(e);
//		employeeService.deleteEmployee(info);
//		employeeService.deleteEmployee(skill);
		return mapping.findForward("success");
	}
	
	
}
